package com.xqboss.apps.service.hama;

import cn.hutool.core.collection.ListUtil;
import com.xqboss.apps.domain.hama.HamaDelayExpireLog;
import com.xqboss.apps.mapper.hama.HamaDelayExpireLogMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 延迟过期日志-空投周期 服务实现类
 * </p>
 *
 * @author 木鱼
 * @since 2024-03-14
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class HamaDelayExpireLogService extends ServiceImpl<HamaDelayExpireLogMapper, HamaDelayExpireLog> {

    @Transactional
    public void saveLogs(List<HamaDelayExpireLog> records) {
        List<List<HamaDelayExpireLog>> split = ListUtil.split(records, 50);
        for (List<HamaDelayExpireLog> logs : split) {
            this.saveBatch(logs);
        }
    }
}